using System;
using System.Collections.Generic;
using System.Text;

namespace My.IdlConverter.Core.Output
{
    public abstract class ExportBase : IExport
    {
        private string _targetPathName;
        private ExportEventHandler _exportEventHandler;

        public ExportBase(string targetPathName)
        {
            _targetPathName = targetPathName;
        }

        public string TargetPath
        {
            get
            {
                return _targetPathName;
            }
            set
            {
                _targetPathName = value;
            }
        }

        public event ExportEventHandler ExportEventHandler
        {
            remove
            {
                if (value == _exportEventHandler)
                {
                    _exportEventHandler = null;
                }
            }
            add
            {
                if (value != null)
                {
                    _exportEventHandler = value;
                }
            }
        }

        protected void FireExportEvent(ExportEventArgs args)
        {
            if (_exportEventHandler != null)
                _exportEventHandler(args);
        }

        public abstract void Export();
    }
}
